<template>
  <div class="rank-list">
    <div class="title">
      <div class="text">
        <div class="title_CN">
          <slot name="title_CN"></slot>
        </div>
        <div class="title_EN">
          <slot name="title_EN"></slot>
        </div>
      </div>
      <slot name="icon"></slot>
    </div>
    <div class="list">
      <div
        class="item"
        v-for="(item, index) in dataList"
        :key="item.id"
        @click="onGoLinkFn(item)"
      >
        <div class="info">
          <div :class="['rank', item.id <= 3 && 'no1']">
            {{ index + 1 }}
          </div>
          <div class="name">{{ item.name }}</div>
        </div>
        <div class="other download" v-if="showType === 'download'">
          <span>下载量：</span>
          <span class="otherSpan"> {{ item.download }}</span>
        </div>
        <div class="other good" v-if="showType === 'good'">
          <span>评分：</span>
          <el-rate
            v-model="item.rank"
            disabled
            :colors="['#FFCE05', '#FFCE05', '#FFCE05']"
            :disabled-void-color="'#4d5352'"
          >
          </el-rate>
        </div>
        <div class="other hot" v-if="showType === 'hot'">
          <span>浏览量：</span>
          <span class="otherSpan">{{ item.hot }}</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {}
  },
  props: {
    dataList: {
      type: Array,
      default: () => [],
    },
    showType: {
      type: String,
      default: '',
    },
  },
  methods: {
    onGoLinkFn(item) {
      this.$store.commit('changeShowItemObj', item)
      this.$router.push({ name: 'integrated' })
    },
  },
}
</script>
<style scoped lang="scss">
.rank-list {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  .title {
    width: 100%;
    flex: 0 0 120px;
    height: 120px;
    box-sizing: border-box;
    padding: 0 32px;
    background: url('../../../assets/images/management-list-title.png') center
      center no-repeat;
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #2cfcfe;
    .title_CN {
      font-size: 32px;
      line-height: 36px;
    }
    .title_EN {
      opacity: 0.3;
      font-size: 14px;
      line-height: 18px;
      margin-top: 6px;
    }
    .icon {
      width: 50px;
      height: 50px;
      background-position: center;
      background-size: cover;
      background-repeat: no-repeat;
    }
  }
  .list {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 10px 20px;
    background: url('../../../assets/images/management-list-bg.png') center
      center no-repeat;
    background-size: 100% 100%;
    .item {
      display: flex;
      width: 100%;
      height: 48px;
      align-items: center;
      cursor: pointer;
      justify-content: space-between;
      .info {
        display: flex;
        align-items: center;
        .rank {
          width: 47px;
          height: 47px;
          font-size: 20px;
          line-height: 48px;
          text-align: center;
          color: #2cfcfe;
          margin-right: 5px;
          &.no1 {
            background: url('../../../assets/images/management-item-no1.png')
              center center no-repeat;
            background-size: cover;
          }
        }
        .name {
          font-size: 16px;
          color: #fff;
        }
      }
      .other {
        color: #2cfcfe;
        font-size: 12px;
        display: flex;
        align-items: center;
        .otherSpan {
          color: #fff;
        }
        /deep/.el-rate {
          .el-rate__icon {
            margin: 0;
          }
        }
      }
    }
  }
}
</style>
